<?php
/**
 * Created by PhpStorm.
 * User: mac
 * Date: 2018/9/13
 * Time: 上午9:58
 */

interface Jisuan {
    public function suan($op1, $op2);
}

class SuanJia implements Jisuan {
    public function suan($op1, $op2)
    {
        return $op1 + $op2;
    }
}

class SuanJian implements Jisuan {
    public function suan($op1, $op2)
    {
        return $op1 - $op2;
    }
}

class SuanCheng implements Jisuan {
    public function suan($op1, $op2)
    {
        return $op1 * $op2;
    }
}

class SuanChu implements Jisuan {
    public function suan($op1, $op2)
    {
        return $op1 / $op2;
    }
}

class Form {
    private $Ji;
    public function __construct($type)
    {
        $class = 'Suan' . $type;
        $this->Ji = new $class;
    }

    public function diaoYong($op1, $op2)
    {
        return $this->Ji->suan($op1, $op2);
    }
}

$from = new Form($argv[1]);
echo $from->diaoYong($argv[2], $argv[3]) . PHP_EOL;